#include <iostream>
#include <algorithm>
using namespace std;

const int N = 5e6 + 10;

int n, k; 
int a[N];

int main()
{
//	cin >> n >> k;
	
	scanf("%d%d", &n, &k); 
	
	for (int i = 0; i < n; i++)	
		scanf("%d", &a[i]);
	
	sort(a, a + n);
	
	cout << a[k] << endl;
	
	return 0;
}
